package com.yileiqian.util;

public class Node<T> {

	private Node<T> next;
	private T value;

	public Node(T value) {
		this.value = value;
	}

	protected void setNext(Node<T> next) {
		this.next = next;
	}

	public Node<T> next() {
		return next;
	}
	
	public void setValue(T value){
		this.value = value;
	}
	
	public T getValue() {
		return value;
	}
	
	public boolean equals(Object o){
		if(o instanceof Node){
			return value.equals(extracted(o).getValue());
		}
		return false;
	}

	private Node<?> extracted(Object o) {
		if(o instanceof Node<?>){
			return (Node<?>) o;
		}
		return null;
	}
}
